package top.yuyufeng.mbuy.exception;

public class BaseException extends Exception {

    /**
     * 默认的异常信息内容
     */
    public static final String DEFAULT_ERR_CODE = "999";
    /**
     * 默认的异常信息内容
     */
    public static final String DEFAULT_ERR_MSG = "系统出错";

    /**
     * 错误代码
     */
    protected String errorCode;
    /**
     * 错误信息描述
     */
    protected String errorMsg;

    public BaseException() {
        this.errorCode = DEFAULT_ERR_CODE;
        this.errorMsg = DEFAULT_ERR_MSG;
    }

    public BaseException(String errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BaseException(String message, String errorCode, String errorMsg) {
        super(message);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BaseException(String message, Throwable cause, String errorCode, String errorMsg) {
        super(message, cause);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BaseException(Throwable cause, String errorCode, String errorMsg) {
        super(cause);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, String errorCode, String errorMsg) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
}
